﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Tomahawk.Runtime.Rendering.Interfaces;
using Tomahawk.Runtime.Rendering.Materials;

namespace Tomahawk.Runtime.Rendering.Objects
{

    /// <summary>
    /// Delegate for rendering with customizable material events
    /// </summary>
    public delegate void RenderMaterialPassDelegate(IRenderable source, SASMaterial material);

    /// <summary>
    /// Common functionality for all material driven entities
    /// </summary>
    public abstract class MaterialEntity : Entity
    {
        #region "Events"

        /// <summary>
        /// This event is raised every time a material is prepared before rendering
        /// </summary>
        public event RenderMaterialPassDelegate OnPrepareMaterial;

        /// <summary>
        /// Utility to raise the event
        /// </summary>
        protected void RaiseOnPrepareMaterial(IRenderable source, SASMaterial material)
        {
            if (OnPrepareMaterial != null) OnPrepareMaterial(source, material);
        }

        #endregion
    }
}
